home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / amos / AMOSList_0197.lzh / AMOSLIST / 000051_amos-request@svcs1.digex.net_Sat Jan 11 11:40:03 1997.msg < prev    next >
Internet Message Format  |  1997-02-02  |  6KB

  1. Received: from svcs1.digex.net (svcs1.digex.net [204.91.197.224])
  2.           by mail3.access.digex.net (8.8.4/8.8.4) with ESMTP
  3.       id LAA05787 for <mcox@access.digex.net>; Sat, 11 Jan 1997 11:40:01 -0500 (EST)
  4. Received: (from daemon@localhost)
  5.           by svcs1.digex.net (8.8.4/8.8.4)
  6.       id JAA27130 for amos-out; Sat, 11 Jan 1997 09:02:33 -0500 (EST)
  7. Received: from mail2.access.digex.net (mail2.access.digex.net [205.197.247.3])
  8.           by svcs1.digex.net (8.8.4/8.8.4) with ESMTP
  9.       id JAA27127 for <amos-list@svcs1.digex.net>; Sat, 11 Jan 1997 09:02:32 -0500 (EST)
  10. Received: from golden.net (root@golden.org [199.166.210.2])
  11.           by mail2.access.digex.net (8.8.4/8.8.4) with ESMTP
  12.       id JAA22022 for <amos-list@access.digex.net>; Sat, 11 Jan 1997 09:02:31 -0500 (EST)
  13. Received: from golden.net (Giark@cisco3-174.golden.net [207.6.168.174]) by golden.net (8.8.2/8.6.12) with SMTP id JAA01970 for <amos-list@access.digex.net>; Sat, 11 Jan 1997 09:02:23 -0500 (EST)
  14. From: "Mr. Giark To You" <joehick@golden.net>
  15. To: AMOS List <amos-list@access.digex.net>
  16. Date: Sat, 11 Jan 1997 09:01:19 -0500
  17. Message-ID: <yam6950.986.4755208@pop.golden.net>
  18. In-Reply-To: <191.6949T711T713@satech.net.au>
  19. X-Mailer: YAM 1.3.3 - Amiga Mailer by Marcel Beck
  20. Subject: Re: cd32 pad
  21. MIME-Version: 1.0
  22. Content-Type: text/plain
  23. Status: RO
  24. X-Status: 
  25.  
  26. On 10-Jan-97, Jasonn wrote:
  27. >Anyone out there know how to read a cd32 control pad thru amos, ie to find
  28. >out the direction the user is pushing and what buttons??
  29.  
  30.                              AMOS With The CD32
  31.                                      by
  32.                              C. Edward Stewart
  33.                             (joehick@golden.net)
  34.                                (IRC: Giark)
  35.  
  36. Whether or not you happen to have a CD32, you may have access to a CD32
  37. joypad.  With it, you have the option of programming a lot more neat options
  38. (because it has a lot of buttons).  There have been several different
  39. programs out there to read the CD32 joypad, but they all lack in one way or
  40. another.  Here's my procedure that does it:
  41.  
  42. Procedure PAD
  43. CD=0 : CD32=0
  44. Lib Open 1,"lowlevel.library",40
  45. Dreg(0)=1
  46. CD=Lib Call(1,-30)
  47. Lib Close 1
  48. If CD and 1 Then CD32=CD32+%1
  49. If CD and 2 Then CD32=CD32+%10
  50. If CD and 4 Then CD32=CD32+%100
  51. If CD and 8 Then CD32=CD32+%1000
  52. If CD and 131072 Then CD32=CD32+%10000
  53. If CD and 262144 Then CD32=CD32+%100000
  54. If CD and 524288 Then CD32=CD32+%1000000
  55. If CD and 1048576 Then CD32=CD32+%10000000
  56. If CD and 2097152 Then CD32=CD32+%100000000
  57. If CD and 4194304 Then CD32=CD32+%1000000000
  58. If CD and 8388608 Then CD32=CD32+%10000000000
  59. End Proc[CD32]
  60.  
  61. To use this procedure, you'll need to get the lowlevel.library (and a CD32
  62. joypad) if you don't have it.  Now, the procedure is nice, but without the
  63. code to use it, it's just so many cool AMOS commands.
  64.  
  65. Do
  66. PAD=0
  67. PAD : PAD=Param
  68. If PAD and 1 Then PAD_RIGHT
  69. If PAD and 2 Then PAD_LEFT
  70. If PAD and 4 Then PAD_DOWN
  71. If PAD and 8 Then PAD_UP
  72. If PAD and 16 Then PAD_PAUSE
  73. If PAD and 32 Then PAD_REWIND
  74. If PAD and 64 Then PAD_FASTFORWARD
  75. If PAD and 128 Then PAD_GREEN
  76. If PAD and 256 Then PAD_YELLOW
  77. If PAD and 512 Then PAD_RED
  78. If PAD and 1024 Then PAD_BLUE
  79. Loop
  80.  
  81. This loop checks all the buttons and acts on them.  If you want different
  82. buttons to be sensed sooner, move them up on the list.  I've got all the
  83. different buttons labeled as procedures, but you could use Goto's or
  84. commands just as easily.  The code above just shows you what values
  85. represent which buttons.
  86.  
  87. Most CD32s don't have keyboards attached, so don't put places in your
  88. program for users to type unless you use some sort of CD32 joypad procedure
  89. to get the characters.  Say something like the one below.
  90.  
  91. Procedure CD32_TEXT
  92. CHAR$="" : CHAR=0 : A$="" : IN$="" : PAD=0
  93. CHAR$="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,.!?() 1234567890"
  94. CHAR=1
  95. Curs Off
  96. CD32:
  97. If CHAR<1 Then CHAR=69
  98. If CHAR>69 Then CHAR=1
  99. A$=Mid$(CHAR$,CHAR,1)
  100. Locate 0,0 : Print IN$;A$;" ";Cleft$;Cleft$;
  101. CD32A:
  102. Do : PAD=0 : PAD : PAD=Param : If PAD=0 Then Loop
  103. If PAD and 4 Then CHAR=CHAR-1 : Wait 5 : Goto CD32
  104. If PAD and 8 Then CHAR=CHAR+1 : Wait 5 : Goto CD32
  105. If PAD and 128
  106.   IN$=IN$+A$
  107.   Locate 0,0
  108.   Print IN$
  109.   Goto CD32B
  110. End If
  111. If PAD and 512 Then IN$=Left$(IN$,Len(IN$)-1) : Wait 15 : Goto CD32
  112. If PAD and 1024 Then IN$=IN$+A$ : Wait 10 : Goto CD32
  113. Goto CD32A
  114. CD32B:
  115. End Proc[IN$]
  116.  
  117. To use the text procedure use the following code:
  118.  
  119. CD32_TEXT : IN$=Param$
  120.  
  121. CD32 joypad up and down scroll through the letters.  Blue advances a
  122. character.  Red deletes a character.  Green terminates input.  The
  123. parameter in IN$ will contain the text entered by the user.
  124.  
  125. With these procedures, you can write AMOS programs that can be included on
  126. CD32 coverdisk CDs.  Also, you can have access to all those neat buttons on
  127. the CD32 joypad.
  128.  
  129. You may be wondering why anyone would want to use a CD32 joypad.  For one
  130. simple reason: More commands at your fingertips!  So go get a CD32 joypad
  131. and start writing cool multi-button programs.
  132.  
  133. Well met and godspeed,
  134.                       Giark
  135.                                            joehick@golden.net
  136.                                    http://www.golden.net/~joehick/
  137.      ______  ______    _____  .------------------------------------------.
  138.     / ____/ / __  /   / ___ \ !     AMOS games, utilities, demos, etc.   !
  139.    / /__   / /_/ /   / /  / / !                                          !
  140.   / ___/  / ___  |  / /  / /  !       CyberSpace BBS (519)579-0072       !
  141.  / /     / /__/ /  / /  / /   !     on A2000 060/50MHz (519)579-0173     !
  142. /_/     /______/  /_/  /_/    !                                          !
  143.    Fly By Nite Videe-Oh!      !  FBN Amiga 500 020 14MHz 1C/5F RAM 3.1OS !
  144.                               `------------------------------------------'
  145.